package com.krautzlabs;

import java.util.ArrayList;

public class GameState {

	private ArrayList<MapPoint> mapPoints;
	private ArrayList<Player> players;
	
	public GameState()
	{
		mapPoints = new ArrayList<MapPoint>();
		//create players....just held here until splash/setup screens made
		//TODO: Create splash/setup screens to instantiate alot of gamestate
		players = new ArrayList<Player>();
		
		
	}
	
	
	
	
	/*
	 * MAP INFO  ----may want to make own MapPointCollection object to contain these methods
	 */
	//just a temporary spot until we figure out how to arrange this all
	public void addMapPoint(MapPoint mPoint)
	{
		this.mapPoints.add(mPoint);
	}
	
	public ArrayList<MapPoint> getMapPoints()
	{
		return mapPoints;
	}
	
	//connects two map points together by adding the other point to each others neighbors array
	public void addMapPointConnection(int id1, int id2)
	{
		MapPoint point1 = null; 
		MapPoint point2 = null;
		
		//find mappoints in the collection based on id to get objects
		for(MapPoint mp: mapPoints)
		{
			if(mp.getId() == id1)
			{
				point1 = mp;
			}
			else if(mp.getId() == id2)
			{
				point2 = mp;
			}
			
			if(point1 != null && point2 != null)
				break;
		}
		
		if(point1 != null && point2 != null)
		{
			point1.addNeighbor(point2);
			point2.addNeighbor(point1);
		}
	}
	/*
	 * MAP INFO END
	 */
	
	/*
	 * PLAYER STUFF
	 */
	
	public void addPlayer(Player player)
	{
		this.players.add(player);
	}
	/*
	 * PLAYER STUFF END
	 */
	
}
